package com.itheima.mapper;

import com.itheima.jopo.Dept;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * DeptMapper
 *
 * @author liliudong
 * @version 1.0
 * @description 部门Mapper
 * @date 2023/4/29 10:00
 */
@Mapper
public interface DeptMapper {
    /**
     * 获取部门的全部数据
     *
     * @return
     */
    @Select("select * from dept")
    List<Dept> selectList();

    /**
     * 根据部门ID删除
     *
     * @param id
     */
    @Delete("delete from dept where id = #{id}")
    void deleteById(String id);

    /**
     * 新增一个部门
     *
     * @param dept
     */
    @Insert("insert into dept(name, create_time, update_time)" +
            "VALUES (#{dept.name}, #{dept.createTime}, #{dept.updateTime})")
    void insertOne(@Param("dept") Dept dept);
}
